<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('项目内审出图列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>编号：</label>
                                <input type="text" name="orderNo"/>
                            </li>
                            <li>
                                <label>项目名称：</label>
                                <input type="text" name="projectName"/>
                            </li>
                            <li>
                                <label>图纸名称：</label>
                                <input type="text" name="tzName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                 <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="gcgl:nsct:edit"> -->
<!--                     <i class="fa fa-edit"></i> 修改 -->
<!--                 </a> -->
<!--                 <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gcgl:nsct:remove"> -->
<!--                     <i class="fa fa-remove"></i> 删除 -->
<!--                 </a> -->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gcgl:nsct:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('gcgl:nsct:edit')}]];
        var removeFlag = [[${@permission.hasPermi('gcgl:nsct:remove')}]];
        var prefix = ctx + "sj/nsct";
        var datasnscttype = [[${@dict.getType('sj_zhuanye')}]];
	    var datasstatus = [[${@dict.getType('sj_contract_status')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "项目内审出图",
                sortName: "id desc",
                sortOrder: "",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'gcProjectid',
                    title: '合同ID',
                    visible: false
                },
                {
                    field: 'projectName',
                    title: '项目名称',
                    visible: false
                },
                {
                    field: 'orderNo',
                    title: '编号'
                },
                {
                    field: 'tzName',
                    title: '图纸名称'
                },
                {
                    field: 'tzType',
                    title: '图纸类型',
		            formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(datasnscttype, item.tzType);
		            }
                },
                {
                    field: 'tzDescs',
                    title: '图纸描述'
                },
                {
                    field: 'spr',
                    title: '审核人'
                },
                {
                    field: 'jdr',
                    title: '校对人'
                },
                {
                    field: 'owner',
                    title: '申请人'
                },
                {
                    field: 'dept',
                    title: '申请部门'
                },
                {
                    field: 'createAt',
                    title: '创建时间'
                },
                {
                    field: 'status',
                    title: '状态',
		            formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(datasstatus, item.status);
		            }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var actions = [];
                        if(row.status==1){
                        	actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="zhct(\'' + row.id + '\')"><i class="fa fa-check"></i> 出图</a> ');
                        }
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i> 查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        
        function zhct(id){
        	$.modal.confirm("确认要出图吗?", function() {
	    		$.ajax({
    				url: "/sj/nsct/zhct",
    				type: "post",
    				data: { "id": id },
    				dataType: 'json',
    				success: function(data) {
    					$.table.refresh();
    				},
    				error: function(xhr, type, errorThrown) {
    					//异常处理；
    					$.modal.alert("请稍后再试！");
    					$.table.refresh();
    				}
    			});
	    	});
        }
    </script>
</body>
</html>